<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>6-9</title>
    <style>
        .div2 {
            font-size: 40px;
            border-bottom: 1px solid;
            padding: 10px;
        }
    </style>
</head>

<body>
    <div id="div1">
        <p>什么是JavaScript</p>
        <p>JavaScript是一门功能强大的编程语言</p>
        <div class="div2">一起学习JavaScript程序设计</div>
        <p>JavaScript的发展历史</p>
    </div>
    <input type="button" value="删除所有p元素">
    <script>
        var bottom = document.querySelector('input');
        bottom.onclick = function() {

            var ps = document.querySelectorAll('p');
            for (let i = 0; i < ps.length; i++) {
                ps[i].parentNode.removeChild(ps[i]); //
            }
        }
    </script>
</body>

</html>